import request from '../utils/request.js';

export const CategoryApi = {
        getList: fid => request({ url: "/category/list/" + fid }
        )
};
export const ProductApi = {
        getList: data => request({ url: "/product/list/", method: "post", data })
};
export const CartApi = {
        getList: () => request({ url: "/cart/list", method: "post" }),
        increase: id => request({ url: "/cart/increase/" + id, method: "post", }),
        decrease: id => request({ url: "/cart/decrease/" + id, method: "post", }),
        remove: data => request({ url: "/cart/remove", method: "post", data }),
        add: data => request({ url: "/cart/add", method: "post", data }),
        total: () => request({ url: "/cart/total", method: "get" }),
        getIdsList: data => request({ url: "/cart/list_ids", method: "post", data })
};
export const AddressApi = {
        getList: () => request({ url: "/address/list", method: "get", }),
        add: data => request({ url: "/address/add", method: "post", data }),
        update: data => request({ url: "/address/update", method: "post", data }),
        remove: id => request({ url: "/address/remove/" + id, method: "get", }),
        setDefault: (id) => request({ url: "/address/set_default/" + id, }),
        getDefault: () => request({ url: "/address/get_default/" })
};
export const OrderApi = {
        getAll: () => request({ url: "/order/list_all" }),
        getPay: () => request({ url: "/order/list_pay" }),
        getUnpay: () => request({ url: "/order/list_unpay" }),
        remove: (id) => request({ url: "/order/remove/" + id }),
        account: id => request(({ url: "/order/account/" + id, method: "get", })),
        pay: id => request({ url: "/order/pay/" + id, method: "get", }),
        confirm: (data) => request({ url: "/order/confirm", method: "post", data })
};

export const UserApi = {
        login: data => request({ url: "/user/login_pwd", method: "post", data })
};
export const DetailsApi = {
        getMode: id => request({ url: "/product/model/" + id, method: "get" }),
};
export const PayApi = {
        submitOrder: data => request({ url: "/order/confirm", method: "post", data })
}
